asm
  ld sp,$7FFF
  end asm

#include "./library/smsrnd.bas"
#include "./library/pacmandelay.bas"
#include "./library/b4r3f0e1_charmapmegadon.zxi"
#include "./library/minivadersldirxor.bas"

dim eee as uinteger at $7810
dim seed as uinteger at $7812
dim ee0 as uinteger at $7814
dim ee1 as uinteger at $7816
dim ee2 as uinteger at $7818
dim ee3 as uinteger at $781A
dim eex as uinteger at $781C
dim eey as uinteger at $781E

sub megadonputchar(txp1 as uinteger,typ1 as uinteger,tch1 as uinteger,tad1 as uinteger,txr1 as ubyte,txo1 as uinteger)
  dim txl1 as uinteger at $7800
  dim tyl1 as uinteger at $7802
  for txl1=0 to 7
    minivadersldirxor( $8000+((txl1+txo1)*136)+((33-typ1)*4)+(txp1*1088) , (tad1+(txl1*4)+(tch1*32)) ,4, txr1)
    next
  end sub

seed=0

for ee1=0 to 33
  for ee0=0 to 28
    seed=smsrnd(seed)
    megadonputchar(ee0,ee1,64+(seed mod 16),@charmap01,$00,2)
    next:next

for ee1=0 to 7
  for ee0=0 to 15
    seed=smsrnd(seed)
    megadonputchar(ee0+12,ee1+17,ee1*16+ee0,@charmap01-1024,$CC,2)
    megadonputchar(ee0+12,ee1+25,ee1*16+ee0,@charmap01-1024,$33,2)
    next:next

eee=0:eex=8:eey=8
do

megadonputchar(1,1,48+(int(eee/100) mod 10),@charmap01-1024,$EE,2)
megadonputchar(2,1,48+(int(eee/10) mod 10),@charmap01-1024,$EE,2)
megadonputchar(3,1,48+(eee mod 10),@charmap01-1024,$EE,2)

ee1=in($00) bxor $FF
megadonputchar(1,3,48+(int(ee1/100) mod 10),@charmap01-1024,$BB,2)
megadonputchar(2,3,48+(int(ee1/10) mod 10),@charmap01-1024,$BB,2)
megadonputchar(3,3,48+(ee1 mod 10),@charmap01-1024,$BB,2)

ee1=in($01) bxor $FF
megadonputchar(1,4,48+(int(ee1/100) mod 10),@charmap01-1024,$BB,2)
megadonputchar(2,4,48+(int(ee1/10) mod 10),@charmap01-1024,$BB,2)
megadonputchar(3,4,48+(ee1 mod 10),@charmap01-1024,$BB,2)

ee1=in($02) bxor $FF
megadonputchar(1,5,48+(int(ee1/100) mod 10),@charmap01-1024,$BB,2)
megadonputchar(2,5,48+(int(ee1/10) mod 10),@charmap01-1024,$BB,2)
megadonputchar(3,5,48+(ee1 mod 10),@charmap01-1024,$BB,2)

eex=eex+((ee1 band 1)/1)-((ee1 band 2)/2)
eey=eey+((ee1 band 4)/4)-((ee1 band 8)/8)

megadonputchar(eex mod 29,eey mod 34,eee band $7F,@charmap01-1024,$77,2)



'for ee0=0 to 3
'  ee1=in(ee0)
'  megadonputchar(1,3+ee0,48+(int(ee1/100) mod 10),@charmap01-1024,$BB,2)
'  megadonputchar(2,3+ee0,48+(int(ee1/10) mod 10),@charmap01-1024,$BB,2)
'  megadonputchar(3,3+ee0,48+(ee1 mod 10),@charmap01-1024,$BB,2)
'  next



eee=eee+1
loop





'----------------------------------------------------------------------


do:loop

do
for ee1=0 to 33
  for ee0=0 to 28
    seed=smsrnd(seed)
    megadonputchar(ee0,ee1,seed mod 80,@charmap01,$EE,2)
    pacmandelay(100)
    next:next
loop

do:loop








do
for ee0=0 to 29
  for ee1=0 to 33
    seed=smsrnd(seed)
    for ee2=0 to 7
      for ee3=0 to 3
        poke $8000+(ee3*1)+(ee2*136)+(ee1*4)+(ee0*1088),peek(@charmap01+ee3+(ee2*4)+((seed mod 80)*32) )
        next:next
    pacmandelay(1000)
    next:next
loop

do:loop




do
for ee0=0 to 29
  for ee1=0 to 33
    for ee2=0 to 7
      for ee3=0 to 3
        poke $8000+(ee3*1)+(ee2*136)+(ee1*4)+(ee0*1088),peek(@bitmaptest01+ee3+(ee2*4))
        next:next
    pacmandelay(10000)
    next:next
loop

do:loop




do

for eee=$8000 to $FFFF step (8*17)
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(5000)
  next

loop


do:loop



do

for eee=$8000 to $FFFF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(5000)
  next

loop


do:loop

bitmaptest01:
asm



  defb $F0,$FF,$FF,$FF
  defb $F0,$FF,$FF,$FF
  defb $00,$F0,$00,$F0
  defb $00,$F0,$00,$F0
  defb $00,$F0,$00,$F0
  defb $00,$F0,$FF,$FF
  defb $00,$00,$FF,$0F
  defb $00,$00,$00,$00




  defb $FF,$FF,$FF,$0F
  defb $FF,$FF,$FF,$0F
  defb $0F,$00,$0F,$00
  defb $0F,$00,$0F,$00
  defb $0F,$00,$0F,$00
  defb $FF,$FF,$0F,$00
  defb $F0,$FF,$00,$00
  defb $00,$00,$00,$00




  defb $01,$23,$45,$67
  defb $89,$AB,$CD,$EF
  defb $01,$23,$45,$67
  defb $89,$AB,$CD,$EF
  defb $01,$23,$45,$67
  defb $89,$AB,$CD,$EF
  defb $01,$23,$45,$67
  defb $89,$AB,$CD,$EF

  defb $00,$11,$22,$33
  defb $00,$11,$22,$33
  defb $44,$55,$66,$77
  defb $44,$55,$66,$77
  defb $88,$99,$AA,$BB
  defb $88,$99,$AA,$BB
  defb $CC,$DD,$EE,$FF
  defb $CC,$DD,$EE,$FF

  defb $FF,$FF,$FF,$F0
  defb $FF,$FF,$FF,$F0
  defb $F0,$00,$F0,$00
  defb $F0,$00,$F0,$00
  defb $F0,$00,$F0,$00
  defb $FF,$FF,$F0,$00
  defb $0F,$FF,$00,$00
  defb $00,$00,$00,$00

  end asm



